<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="200px" class="el-aside">
        <div class="logo">付费问答系统管理</div>
        <el-menu
          active-text-color="#ffd04b"
          background-color="transparent"
          :default-active="$route.path"
          text-color="#fff"
          router
        >
          <el-menu-item index="/home/admin/userAdmin">
            <span>用户管理</span>
          </el-menu-item>
          <el-menu-item index="/home/admin/TagsAdmin">
            <span>标签管理</span>
          </el-menu-item>
          <el-menu-item index="/home/admin/QuestionAdmin">
            <span>问题管理</span>
          </el-menu-item>
          <el-sub-menu index="1">
            <template #title>
              <span>举报管理</span>
            </template>
            <el-menu-item index="/home/admin/QuestionReport">问题举报管理</el-menu-item>
            <el-menu-item index="/home/admin/AnswerReport">回答举报管理</el-menu-item>
          </el-sub-menu>
          <el-menu-item index="/home/admin/TranscactionAdmin">
            <span>财务管理</span>
          </el-menu-item>

          <el-menu-item index="/home/admin/Data">
            <span>系统数据</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <transition name="fade" mode="out-in">
          <router-view></router-view>
        </transition>
      </el-main>
    </el-container>
  </div>
</template>

<style scoped>
.el-aside {
  height: 100vh;
  background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  transition: background-color 0.3s ease;
  position: sticky;
  top: 0;
}

.logo {
  font-size: 20px;
  color: #3670ee;
  text-align: center;
  margin: 10px 0;
  transition: transform 0.3s;
}

.el-menu-item {
  transition: all 0.3s;
}

.el-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.el-main {
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 动画效果 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s ease;
}
.fade-enter, .fade-leave-to /* .fade-leave-active in <2.1.8 */ {
  opacity: 0;
}

/* 加载动画 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* 根据需要调整高度 */
  font-size: 24px;
  font-weight: bold;
  color: #3670ee;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
</style>
